<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>Api首页</title>
<%@ include file="/WEB-INF/views/include.inc.jsp"%>
<style type="text/css">
.widbox2 .bg-lightBlue {
    background-color: #4390df !important;
}
.widbox2 .fg-white {
    color: #ffffff !important;
}
</style>
</head>
<body>
<div class="container">
  <c:import url="/main/header"/>
  
  <page:paginationForm action="${contextPath }/main/api/list" page="${page }">
	<input type="hidden" name="title" value="${param.title }" />
  </page:paginationForm>
  <div class="main2">
    <div class="content2">
	  <div class="content-wrap news2">
	    <div class="widbox widbox2">
	      <div class="left3">
	        <div class="name3">数据分类浏览</div>
	        <ul>
	          <li class="on" onclick='goToPage("${contextPath }/main/api/list")'>全部API<sup class="bg-lightBlue fg-white" style="padding:0 5px;margin-left:5px">${apiCount }</sup></li>
	    	  <c:forEach var="level1" items="${menuModule.children }">
	            <li id="type_${level1.id }" onclick='goToPage("${contextPath }/main/api/list?type=${level1.id }")'>
	              ${level1.name }<sup class="bg-lightBlue fg-white" style="padding:0 5px;margin-left:5px">${level1.num }</sup>
	            </li>
	    	  </c:forEach>
	    	  <c:if test="${not empty user}">
	    	    <li class="on" onclick='goToPage("${contextPath }/main/upload")'>数据上传</li>
	    	  </c:if>
	        </ul>
	      </div>
	      <div class="right3">
	        <ul>
	    	  <c:forEach var="api" items="${apiList }">
	        	<a href="${contextPath }/main/api/view/${api.id}" target="_blank">
	          	  <li>
		            <img src="${contextPath }${api.url }" class="img">
		            <div class="text3">
		              <h3>${api.title }</h3>
		              <div class="div3">${api.description }</div>
		            </div>
	          	  </li>
	            </a>
	          </c:forEach>
	        </ul>
			<page:pagination page="${page }" />
	      </div>
	    </div>
	  </div>
    </div>
  </div>
	  
  <c:import url="/layout/footer"/>
</div>
<script type="text/javascript">
$(function(){
	var id = getUrlParam('type');
	if (id != null) {
		$(".left3 li").removeClass("on");
		$("#type_"+id).addClass("on");
	};
});
</script>
</body>
</html>
